import matplotlib.pyplot as plt
import csv

'''读取csv文件'''


def readcsv(files):
    csvfile = open(files, 'r')
    plots = csv.reader(csvfile, delimiter=',')
    x = []
    y = []
    # 读取csv文件中2,3列的数据，且转化为float类型
    for row in plots:
        y.append(float(row[2]))
        x.append(float(row[1]))
    return x, y


x, y = readcsv(r"C:\Users\admin\Desktop\论文第二稿\实验结果\loss\run-MyModel-tag-Train_Loss.csv")
plt.plot(x, y, 'blue', label='MyModel')

plt.xlabel("step", fontsize=15)
plt.ylabel("loss", fontsize=15)
plt.legend()
plt.show()
